<!-- PlcData数据 -->
<template>
  <div class="Plc-data-container">
    <div class="left">
      <div class="top">
        <el-input
          placeholder="请输入内容"
          prefix-icon="el-icon-search"
          v-model="form.tableName"
        >
        </el-input>
      </div>
      <div class="bottom">
        <el-tree
          ref="tree2"
          :data="data2"
          :props="defaultProps"
          highlight-current
          class="filter-tree"
          default-expand-all
        />
      </div>
    </div>
    <div class="right">
      <div class="app-container">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="84px"
        >
          <el-form-item label="数据类型" prop="shebei">
            <el-input
              v-model="queryParams.shebei"
              placeholder="请输入设备名称"
              clearable
            />
          </el-form-item>
          <el-form-item label="字段类型" prop="shijiancha">
            <el-input
              v-model="queryParams.shijiancha"
              placeholder="请输入时间偏差值"
              clearable
            />
          </el-form-item>
          <el-form-item label="长度" prop="shebei">
            <el-input
              v-model="queryParams.shebei"
              placeholder="请输入设备名称"
              clearable
            />
          </el-form-item>
          <el-form-item label="创建时间" prop="shebei">
            <el-date-picker
              v-model="queryParams.shebei"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['system:timedeviation:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['system:timedeviation:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['system:timedeviation:remove']"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['system:timedeviation:export']"
              >导出</el-button
            >
          </el-col>
          <right-toolbar
            :showSearch.sync="showSearch"
            @queryTable="getList"
          ></right-toolbar>
        </el-row>

        <el-table
          v-loading="loading"
          :data="tableData"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="ID" align="center" prop="id" />
          <el-table-column label="打包名称" align="center" prop="shebei" />
          <el-table-column label="创建时间" align="center" prop="shijiancha" />
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['system:timedeviation:edit']"
                >修改</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['system:timedeviation:remove']"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />

        <!-- 添加或修改设备时间偏差对话框 -->
        <el-dialog
          :title="title"
          :visible.sync="open"
          width="500px"
          append-to-body
        >
          <el-form ref="form" :model="form" :rules="rules" label-width="80px">
            <el-form-item label="设备名称" prop="shebei">
              <el-input v-model="form.shebei" placeholder="请输入设备名称" />
            </el-form-item>
            <el-form-item label="设备时间偏差值" prop="shijiancha">
              <el-input
                v-model="form.shijiancha"
                placeholder="请输入设备时间偏差值"
              />
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      data2: [
        {
          id: 1,
          label: "数据表",
          children: [
            {
              id: 4,
              label: "波前数据表",
            },
            {
              id: 9,
              label: "分布光纤表",
            },
            {
              id: 10,
              label: "光谱数据表",
            },
          ],
        },
      ],

      defaultProps: {
        children: "children",
        label: "label",
      },
      tableData:[],
      loading: false,
      //
      showSearch: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        shebei: null,
        shijiancha: null,
      },
      total: 0,
      title: null,
      multiple:null,
      single: null,
      open: false,
      rules:{},
      //搜索框值
      form: {
        tableName: "",
      },
    };
  },
  methods: {
    handleQuery(){},
    resetQuery(){},
    handleAdd(){},
    handleUpdate(){},
    handleDelete(){},
    handleExport(){},
    getList(){},
    submitForm(){},
    cancel(){},
    handleSelectionChange(){}
  },
  mounted() {},
};
</script>
<style lang="scss" scoped>
.Plc-data-container {
  height: 100%;
  display: flex;
  .left {
    flex: 1;
    .top {
      padding: 22px 35px;
    }
    .bottom {
      padding: 5px 10px 5px 35px;
    }
  }
  .right {
    flex: 6.5;
  }
}
</style>
